package com.jt.controller;

import com.jt.pojo.MovieCat;
import com.jt.service.MovieCatService;
import com.jt.vo.SysResult;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/movieCat")
public class MovieCatController {
    @Autowired
    private MovieCatService movieCatService;

    // 根据等级查询类型
    @GetMapping("/getMovieCat/{level}")
    public SysResult getMovieCat(@PathVariable Integer level){
        List<MovieCat> list = movieCatService.getMovieCat(level);
        return SysResult.success(list);
    }

    // 添加类型
    @PostMapping("/addType")
    public SysResult addType(@RequestBody MovieCat movieCat){
        movieCatService.addType(movieCat);
        return SysResult.success();
    }

    // 删除类型
    @DeleteMapping("/deleteType/{id}")
    public SysResult deleteType(@PathVariable Integer id){
        movieCatService.deleteType(id);
        return SysResult.success();
    }

}
